<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="vue.js"></script>
    <title>Title</title>
</head>
<body>
<div id="box">
    {{a}}
    <br>
    {{b}}
</div>
</body>
<script>
    Vue.config.keyCodes.myenter=13;
    var app = new Vue({
        el: '#box',
        data: {
           a: {name:'john',age:12},
           b: 2
        }
    })
    //{deep:true} 深度监视
    app.$watch('a',function () {
        this.b = this.a.age;
    },{deep:true})
</script>
</html>